package com.ld.entity;

import lombok.*;

@NoArgsConstructor
@AllArgsConstructor
@ToString
public class PageInfo {
    /**数据库总条数*/
    private int totalCount;
    /**页面大小,默认是10*/
    private int pageSize=10;
    /**当前页*/
    private int currentPage;
    /**总页数*/
    private int totalPage;


    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }
    //注意调用的时候必须先set总条数。先set页面大小会空指针
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        if (this.totalCount%this.pageSize==0){
            this.totalPage=this.totalCount/this.pageSize;
        }else {
            this.totalPage=this.totalCount/this.pageSize+1;
        }
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getTotalPage() {
        return totalPage;
    }


}
